package com.tg.app.activity.device.add;
import android.content.Context;

import com.base.BaseActivity;
import com.tange.module.core.wifi.scan.WiFiScanManager;
import com.tg.appcommon.android.WifiBroadcastReceiver;
import com.tg.appcommon.android.WifiBroadcastReceiverHelper;

public abstract class ApBaseActivity extends BaseActivity {
    private WifiBroadcastReceiverHelper mWifiBroadcastReceiverHelper = new WifiBroadcastReceiverHelper();
    @Override
    public void onResume() {
        super.onResume();
        mWifiBroadcastReceiverHelper.registerReceiver(this);
        mWifiBroadcastReceiverHelper.setReceiverListener(new WifiBroadcastReceiver.WifiBroadcastReceiverListener() {
            @Override
            public void onWifiListChanged() {
                wifiListChanged();
            }

            @Override
            public void onWifiConnected() {
                wifiConnected();
            }

            @Override
            public void onUnavailable() {
                wifiUnavailable();
            }
        });

    }

    @Override
    public void onPause() {
        super.onPause();
        mWifiBroadcastReceiverHelper.unregisterReceiver(this);
    }

    protected void startScan(Context context){
        WiFiScanManager.scanner().startScan(context);
    }

    protected abstract void wifiListChanged();
    protected abstract void wifiConnected();
    protected abstract void wifiUnavailable();

}
